home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Unsupported tools / VULogger < prev   
Encoding:
Text File  |  1993-02-04  |  3.0 KB  |  96 lines  |  [TEXT/MPS ]

  1. ###    Parse command line ###
  2.  
  3. set VERSION "1.0"
  4.  
  5. set Exit 0            # do not exit on non-zero status
  6. set KeepOnGoingLog 0
  7. set OnGoingLogFlag 0
  8. set OutPutFileFlag 0
  9. set HelpFlag 1
  10. set VUOptions ""
  11. set CMD    "{0}"
  12. unset OutputFileList
  13.  
  14. for Parm in {"Parameters"}                    # for each parameter on the command line
  15.     if {HelpFlag}
  16.         set HelpFlag 0
  17.         echo "Processing {CMD} parameters..."
  18.     end
  19.     
  20.     if "{Parm}" =~ /-lo/                    # keep ongoing log file
  21.         set KeepOnGoingLog 1                # set flag to keep a continuous log file
  22.         set OnGoingLogFlag 1                # set flag - log file OutputSuffix coming next
  23.         Continue
  24.     else 
  25.         if (!{OnGoingLogFlag})                # add parameter onto VU Options
  26.             set VUOptions "{VUOptions} '{Parm}'"
  27.             if "{Parm}" =~ /-o≈/            # output filename is next
  28.                 set OutPutFileFlag 1
  29.                 Continue
  30.             end
  31.         end
  32.     end
  33.     
  34.     if {OnGoingLogFlag}                        # Parm is the OutputSuffix for the log file
  35.         if "{Parm}" =~ /-≈/                    # bad syntax - no suffix after -lo
  36.             echo "No OutputSuffix was given for the -lo option."
  37.             echo "{CMD} will use ∂"Ful∂" for the compiled output file."
  38.             set OutputSuffix "Ful"
  39.             set VUOptions "{VUOptions} '{Parm}'"
  40.         else
  41.             set OutputSuffix "{Parm}"        # set the OutputSuffix
  42.         end
  43.         set OnGoingLogFlag 0                # turn it off
  44.     end
  45.     
  46.     if {OutPutFileFlag}                        # add the Parm to the output file list
  47.         set OutputFileList "`quote {OutputFileList}` ∂"{Parm}∂""
  48.         set OutPutFileFlag 0
  49.     end
  50. end        
  51.     
  52. # see if user wanted help on VULogger parameters
  53. if {HelpFlag}
  54.     echo ""
  55.     echo "#"
  56.     echo "#    {CMD} {VERSION} - by David Matzner - SIAC, Apple Computer."
  57.     echo "#                        based on VULinker by Nick Vaccaro"
  58.     echo "#"
  59.     echo "#    Description: {CMD} maintains continuous VU log files by concatenating"
  60.     echo "#        the logs for each script run on a target into a single file."
  61.     echo "#"
  62.     echo "#    Parameters: {CMD} accepts one more parameter than VU:"
  63.     echo "#"
  64.     echo "#        -lo (keep ongoing output files) option.  The -lo option creates ongoing"
  65.     echo "#            output logs for each target.  Ordinarily VU overwrites existing"
  66.     echo "#            output files when a script begins.  This flag by-passes that "
  67.     echo "#            limitation by concatenating the old log to a continuous log file."
  68.     echo "#            If the -lo flag is found, {CMD} expects the next parameter to be a"
  69.     echo "#            suffix for the name of the continuous log file.  Otherwise the "
  70.     echo "#            default suffix 'Ful' will be appended to the output filename."
  71.     echo "#            An example of the -lo option is:"
  72.     echo "#"            
  73.     echo "#            {CMD} -t1 '*:TargetName' -s 'HD:MyScript'-o1 'TargetOut' -lo 'FullLog' "
  74.     echo "#"
  75.     echo "#            The above command would create a file named ∂"TargetOut.FullLog∂""
  76.     echo "#            and will copy the ∂"TargetOut∂" output file to the end of the "
  77.     echo "#            ∂"TargetOut.FullLog∂" file."
  78.     echo "#"
  79.     echo ""
  80.     exit 1
  81. end
  82.  
  83. #Do it!
  84. #echo VU {VUOptions}
  85. VU {VUOptions}
  86.  
  87. set exitCode `EVALUATE {status}`
  88. #echo {exitCode}
  89.  
  90. # catenate the files if ongoing logs are being maintained and VU terminated normally
  91. if {KeepOnGoingLog}   #&& !{exitCode}
  92.     #echo "Catenating files…"
  93.     for outFile in {OutputFileList}
  94.         catenate "{outFile}" >> "{outFile}.{OutputSuffix}"
  95.     end
  96. end